package com.weareint.biz.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.weareint.biz.dto.PrinterDTO;
import com.weareint.common.entity.AbstractEntity;
import com.weareint.common.utils.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 *
 *
 *
 * <pre>
 *     打印机
 * </pre>
 *
 * @author Auto Generator
 * @date 2021-07-28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("printer")
@ApiModel(value = "打印机", description = "打印机")
public class Printer extends AbstractEntity<PrinterDTO> {

    @ApiModelProperty(value = "打印机IP地址")
    @TableField("ip")
    private String ip;

    @ApiModelProperty(value = "打印机编码")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "打印机端口")
    @TableField("port")
    private Integer port;

    @ApiModelProperty(value = "状态：0禁用，1启用")
    @TableField("state")
    private Integer state;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "使用类型：1表示大箱打印机，2表示小盒打印机")
    @TableField("use_type")
    private Integer useType;

    @ApiModelProperty(value = "是否支持手动打印：0表示不支持手动打印，1表示支持手动打印")
    @TableField("manual_print_enabled")
    private Integer manualPrintEnabled;



    public static final String CREATE_TIME ="create_time";

    public static final String UPDATE_TIME ="update_time";

    public static final String CREATOR ="creator";

    public static final String UPDATER ="updater";

    public static final String ID ="id";

    public static final String IP ="ip";

    public static final String CODE ="code";

    public static final String PORT ="port";

    public static final String STATE ="state";

    public static final String REMARK ="remark";

    public static final String USE_TYPE ="use_type";

    public static final String MANUAL_PRINT_ENABLED ="manual_print_enabled";


    public static final String[] COLUMNS =
            new String[] {
                    CREATE_TIME,
                    UPDATE_TIME,
                    CREATOR,
                    UPDATER,
                    ID,
                    IP,
                    CODE,
                    PORT,
                    STATE,
                    REMARK,
                    USE_TYPE,
                    MANUAL_PRINT_ENABLED
            };

    /**
     *
     *
     * <pre>
     *     创建对应的DTO
     * </pre>
     * @return {@link PrinterDTO}
     */
    @Override
    public PrinterDTO toDTO() {
        PrinterDTO dto = new PrinterDTO();
        dto.setCreateTime(DateUtil.format(this.getCreateTime()));
        dto.setUpdateTime(DateUtil.format(this.getUpdateTime()));
        dto.setCreator(this.getCreator());
        dto.setUpdater(this.getUpdater());
        dto.setId(this.getId());
        dto.setIp(this.getIp());
        dto.setCode(this.getCode());
        dto.setPort(this.getPort());
        dto.setState(this.getState());
        dto.setRemark(this.getRemark());
        dto.setUseType(this.getUseType());
        dto.setManualPrintEnabled(this.getManualPrintEnabled());
        return dto;
    }
}
